public class Numbers
{
   /**
      Combines two numbers with a given operator.
      @param op one of "+", "-", "*", "/", or "^" (for power)
      @param first the first argument
      @param second the second argument
      @return the result of evaluating the operator with the arguments
   */
   public static double evaluate(String op, double first, double second)
   {
      double result = 0.0;      
      if(op.equals("+"))
      {
         result =  first + second;
      }
      else if(op.equals("-"))
      {
         result =  first - second;
      }
      else if(op.equals("*"))
      {
         result =  first * second;
      }
      else if(op.equals("/"))
      {
         result =  first / second;
      }
      else if(op.equals("^"))
      {
         result =  Math.pow(first, second);
      }
      return result;
   }
}